package com.league.zjxn.jetpack.vmodel

import android.app.Application
import androidx.lifecycle.MutableLiveData
import com.league.zjxn.base.BaseViewModel
import com.league.zjxn.entity.HomeDataResponse
import com.league.zjxn.entity.HomeSearchResponse
import com.league.zjxn.entity.MessageResponse
import com.league.zjxn.entity.TrendData1Response
import com.league.zjxn.jetpack.repository.HomeRepository
import com.module.lemlin.http.HttpResponseBody
import com.module.lemlin.http.HttpResponseData
import com.module.lemlin.http.SubscribeViewModel


class HomeViewModel(application: Application) : BaseViewModel(application) {

    private val mHomeRepository: HomeRepository = HomeRepository()

    val homeDataLiveData = MutableLiveData<HttpResponseBody<HomeDataResponse>>()

    fun homeIndexApp() {
        setRxLifeScope(SubscribeViewModel(homeDataLiveData)) {
            mHomeRepository.homeIndexApp()
        }
    }

    val trendData1LiveData = MutableLiveData<HttpResponseBody<TrendData1Response>>()
    fun homeTrendData(type: Int) {
        setRxLifeScope(SubscribeViewModel(trendData1LiveData)) {
            mHomeRepository.homeTrendData(type.toString(), page = "1", limit = "50")
        }
    }


}